package chenji.StrongFossil;

import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

import chenji.StrongFossil.Config.StrongFossilConfig;
import chenji.StrongFossil.Inventory.PunchManager;
import chenji.StrongFossil.Puncher.Puncher;
import chenji.StrongFossil.Puncher.PuncherManager;
import chenji.StrongFossil.listeners.PunchListener;
import chenji.StrongFossil.Fossil.PuncherFossil.PunchFossil;
import chenji.StrongFossil.Fossil.PuncherFossil.PunchFossilManager;

public class Main extends JavaPlugin {
	private static Logger log;
	private static PunchManager pm;
	private static File datafolder;
	private static Plugin plugin;
	@SuppressWarnings("unused")
	private static StrongFossilConfig config;
	private static PunchFossilManager sfm;
	private static PuncherManager perm;

	public void onEnable() {

		
		log = this.getLogger();
		log.log(Level.INFO, "强化石插件正在加载中，来自小组未知之域，作者：沉寂");
		getCommand("StrongFossil").setExecutor(new Command());
		datafolder = getDataFolder();
		@SuppressWarnings("unused")
		StrongFossilConfig f = new StrongFossilConfig();
		Bukkit.getPluginManager().registerEvents(new PunchListener(), this);
		plugin = this;
		
	}

	public static Logger getLog() {
		return log;
	}

	public static File getDataFile() {
		return datafolder;
	}

	public static Plugin getPlugin() {
		return plugin;
	}

	public static PunchManager getPunchManager() {
		return pm;
	}

	public static StrongFossilConfig getConfigManager() {
		return null;
		// TODO Auto-generated method stub
	}

	public static void InitializePunchFossilManager(HashSet<PunchFossil> list) {
		Main.sfm = new PunchFossilManager(list);
	}

	public static void InitializePuncherManager(HashSet<Puncher> list) {
		Main.perm = new PuncherManager(list);
	}

	public static PunchFossilManager getPunchFossilManager() {
		return sfm;
	}

	public static PuncherManager getPuncherManager() {
		return Main.perm;
	}
	public static void InitializePunchManager(HashMap<Material, Integer> punchList,
			HashMap<Material, Double> levelChance, HashMap<Material, Double> brokeStartChance,
			HashMap<Material, Double> brokeLevelAdd) {
		pm = new PunchManager(punchList, levelChance, brokeStartChance, brokeLevelAdd);

	}

	public static void installPunchManager(boolean enableBroken, boolean enableChance, double defaultChance,
			String emptyPunchName, boolean arrowOtherLore, List<String> limitLoreList) {
		Main.pm.install(enableBroken,enableChance,defaultChance,emptyPunchName,arrowOtherLore,limitLoreList);
		
	}
}
